package com.huaxinkai.mobile.service;

import java.sql.Timestamp;
import java.util.List;
import java.util.Map;

import com.huaxinkai.entity.BaseEntity;

@SuppressWarnings({"rawtypes"})
public interface IBaseService {
	
	public void openSession() throws Exception;

	public void closeSession() throws Exception;

	public void getCurrentSession() throws Exception;
	
	

	public boolean update(String sql) throws Exception;

	public boolean update(int id, String column, String val, String tablename) throws Exception;

	public boolean update(int id, Map keyAndVal, String tablename) throws Exception;

	public boolean update(String tablename, Map setMap, Map whereMap) throws Exception;

	public boolean update(String sql, Object... params) throws Exception;

	public boolean update(String sql, Map<String, Object> params) throws Exception;

	public boolean insert(BaseEntity obj) throws Exception;
	
	public boolean insert(String sql) throws Exception;
	
	public boolean delete(String sql) throws Exception;
	
	public int queryCount(String hql, int rows) throws Exception;
	
	public int queryCount(String hql, Object[] objects) throws Exception;
	
	public int querySqlCount(String sql, Object[] params, int rows) throws Exception;
	
	public int querySqlCount(String sql, Map<String, Object> params, int rows) throws Exception;
	
	public Object queryOne(Class clazz, String column, Object value) throws Exception;
	
	public List query(String hql) throws Exception;
	
	public List query(Class clazz, String[] column, Object[] value) throws Exception;
	
	public Timestamp timestamp(int month, int day, int hour) throws Exception;
	/***
	 * 批量生成insert sql并且执行
	 * 
	 * @param tableName
	 * @param columns
	 *            例如： new Object[]{"name","mobile"}
	 * @param values
	 *            可变参数 ：如 new Object[]{
	 * 
	 *            new Object[]{"张三","李四","王五","赵六"}, new
	 *            Object[]{"13582xxxxxxx","13582xxxxxxx"
	 *            ,"13582xxxxxxx","13582xxxxxxx"}
	 * 
	 *            }
	 * @return
	 * @throws Exception
	 */
	public boolean insert(String tableName, Integer[] appendChar, Object[] columns, Object[]... values) throws Exception;

	public boolean delete(BaseEntity obj) throws Exception;

	public boolean delete(Integer[] ids, String tableName) throws Exception;

	public boolean update(BaseEntity obj) throws Exception;

	public boolean delete(int id, String tableName) throws Exception;

	public boolean delete(Integer id, String tableName) throws Exception;

	public boolean delete(int id, String pkName, String tableName) throws Exception;

	public boolean delete(String pkVal, String pkName, String tableName) throws Exception;

	public boolean delete(Integer id, String pkName, String tableName) throws Exception;

	public boolean delete(Integer[] id, String pkName, String tableName) throws Exception;

	public boolean delete(String tableName, String pkName, String appendSql, Integer... ids) throws Exception;

	public int queryCount(Class clazz, int rows) throws Exception;

	public int queryCount(String hql, int rows, Object... params) throws Exception;

	public int queryCount(String hql, Object[] params, int rows) throws Exception;

	public int queryCount(String hql, Map<String, Object> params, int rows) throws Exception;

	public Object query(Class clazz, int id) throws Exception;

	public Object query(Class clazz, String column, Object value) throws Exception;

	public List query(Class clazz) throws Exception;

	public List query(Class clazz, Integer... ids) throws Exception;

	public List query(String hql, Object... params) throws Exception;

	public List query(String hql, Map<String, Object> params) throws Exception;

	public List query(String hql, int page, int rows, Object... params) throws Exception;

	public List query(String hql, Object[] params, int page, int rows) throws Exception;

	public List query(String hql, Map<String, Object> params, int page, int rows) throws Exception;

	public Object queryOne(String hql) throws Exception;

	public Object queryOne(String hql, Map<String, Object> params) throws Exception;

	public Object queryOne(String hql, Object... params) throws Exception;

	public Object querySqlOne(String sql) throws Exception;

	public Object querySqlOne(String sql, Object... params) throws Exception;

	public Object querySqlOne(String sql, Map<String, Object> params) throws Exception;

	public List querySql(String sql) throws Exception;

	public List querySql(String sql, int page, int rows) throws Exception;

	public List querySql(String sql, Object... params) throws Exception;

	public List querySql(String sql, Map<String, Object> params) throws Exception;

	public List querySql(String sql, int page, int rows, Object... params) throws Exception;

	public List querySql(String sql, Object[] params, int page, int rows) throws Exception;

	public List querySql(String sql, Map<String, Object> params, int page, int rows) throws Exception;

	public String getSql(String name) throws Exception;

	public String getSql(String name, Object... params) throws Exception;

	public String getSql(String name, Map params) throws Exception;

}